﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AgencyEntityLib.BaseEntity;
using Ecopsy.Tools;
using FormControllers;
using Ecopsy.DataTier;

public partial class Ctl_ctlEmployee : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        tvEmpl.DataSource = iPageController.Get_RbCheckBox_TreeSource(DepTree, IsSelectedCheckBox, F_NodeFormatter, "chTree_Empl", hf_SelectedEmpl.ClientID);
        tvEmpl.DataBind();
        tvEmpl.CollapseAll();

    }


    private TreeNodeFormatter_Rb_EmplTree  F_NodeFormatter(TreeEntitySingle Dep, TreeNodeFormatter_Rb.TreeRbContext Context)    
    {
        return new TreeNodeFormatter_Rb_EmplTree(Dep, Context); 
    }

        

    protected bool IsSelectedCheckBox(TreeEntitySingle _tr)
    {
        return ((TreeNodeFormatter_Rb_EmplTree.TreeEmplWrap)_tr).Employeer.ID == EmplID;
        
    }



    public string EmplID { get { return hf_SelectedEmpl.Value; } set { hf_SelectedEmpl.Value = value; } }

    protected override void OnDataBinding(EventArgs e)
    {
        base.OnDataBinding(e);
    }

    private Department DepTree
    {
        get { return GlobalConstants.CurrentAgency.Department; }
    }


    
    
}
